/**
 * 风险评估字典条目规则表管理初始化
 */
var PatCase = {
    id: "PatCaseTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1,
    depType: "科室",
};

/**
 * 初始化表格的列
 */
PatCase.initColumn = function () {
    return [
        {visible: false},
        {title: '病种名称', field: 'entityDesc', align: 'left', width: 110, valign: 'middle'},
        {title: '出院日期', field: 'dishDate', align: 'left', width: 100, valign: 'middle'},
        {title: '病案号', field: 'mrNum', align: 'left', width: 80, valign: 'middle'},
        {title: '姓名', field: 'name', align: 'left', width: 70, valign: 'middle'},
        {title: '性别', field: 'sex', align: 'left', width: 40, valign: 'middle'},
        {title: '年龄', field: 'age', align: 'left', width: 40, valign: 'middle'},
        {title: '科室', field: 'locDesc', align: 'left', width: 80, valign: 'middle'},
        {title: '主治医生', field: 'admDoctorName', align: 'left', width: 70, valign: 'middle'},
        {
            title: '状态', field: 'status', align: 'left', width: 60, valign: 'middle',
            formatter: function (value, row, index) {
                var ret = "";
                switch (value) {
                    case "I":
                        ret = "待填报"
                        break;
                    case "Submit":
                        ret = "提交"
                        break;
                    case "Check":
                        ret = "审核"
                        break;
                    case "Back":
                        ret = "退回"
                        break;
                    case "Up":
                        ret = "上报"
                        break;
                    default:
                        break;
                }
                return ret;
            }
        },
        {title: '就诊号', field: 'episodeId', align: 'left', width: 80, valign: 'middle'}
    ];
};


/**
 * 查询病例
 */
PatCase.search = function () {

    var queryData = {};
    queryData['episodeId'] = $("#episodeId").val();
    queryData['name'] = $("#name").val();
    PatCase.table.refresh({query: queryData,pageNumber: 1});

}

$(function () {

    //列名称
    var defaultColunms = PatCase.initColumn();
    var table = new BSTable(PatCase.id, Sys.backendPath + "/analysis/qcportal/selectPatTrendCaseList", defaultColunms);
    table.setPaginationType("client");
    table.setQueryParams({
        "key": $("#key").val(),
        "entityType": $("#entityType").val(),
        "entityId": $("#entityId").val(),
        "office": $("#office").val(),
        "depart": $("#depart").val(),
        "doctor": $("#doctor").val(),
        "dishDate": $("#dishDate").val()
    })
    table.setShowColumns(false);
    table.setShowRefresh(false);
    table.setPageSize(15);
    //table.setPageList([15,30,50,100]);
    table.setShowToggle(false);
    table.setShowExport(false);
    /*table.setFixedColumns(true);//是否固定列
    table.setFixedNumber(4);//固定前几列*/
    table.setSubHeight(-27);
    PatCase.table = table.init();

});
